#ifndef PCONN_H
#define PCONN_H 

#ifdef ZTS
#include "TSRM.h"
#endif

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#include "php.h"
#include "php_ini.h"

#include <stdio.h>
#include <errno.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#include <netdb.h>
#include <fcntl.h>
#include <time.h>
#include <unistd.h>
#include <stdarg.h>

#define PCONN_VERSION "1.0"
#define PCONN_EXTNAME "pconn"
/*
#ifdef ZTS
#define PCONN_G(v) TSRMG(pconn_globals_id, zend_pconn_globals *, v)
#else
#define PCONN_G(v) (pconn_globals.v)
#endif
*/
int logit(int level, const char *fmt, ...);
int pconn_init(const char* destip, unsigned int destport);
int pconn_send(int sfd, char * buf, int len);
int pconn_recv(int sfd, char * buf, int len);
int pconn_close(int sfd);
int parse_len(const char *buf, int *header_len);
int get_my_addr(char *addr, int len);

PHP_FUNCTION(pconn_req);
PHP_FUNCTION(pconn_stat);


PHP_MINIT_FUNCTION(pconn);
PHP_MSHUTDOWN_FUNCTION(pconn);
/*PHP_RINIT_FUNCTION(pconn);
PHP_RSHUTDOWN_FUNCTION(pconn);
*/
extern zend_module_entry pconn_module_entry;
#define phpext_pconn_ptr &pconn_module_entry

#endif

